<div class="content">

	<div id="left-column">
		<?php echo $this->element('left_column')?>		
	</div>
	
	<div class="right-store-column search-bg">
		<?php echo $this->element('search_more',array('plugin'=>'store'))?>
	</div>
	
	<div class="right-store-column">		
		<div class="storeProducts">
			<?php 
				$storeGroupName = (isset($storeGroupName)) ? $storeGroupName : '';
			?>
			<h2><?php echo $storeGroupName;?></h2>
			
			<div id="display-type">
				<?php echo $this->Html->link($this->Html->image(HOST.'/buttons_icons.png'),Router::url($this->here, false).'/display:icons',array('escape'=>false))?>
				<?php echo $this->Html->link($this->Html->image(HOST.'/buttons_list.png'),Router::url($this->here, false).'/display:list',array('escape'=>false))?>
			</div>
			
			<?php $paginator->options(array('url' => $this->passedArgs));?>
			
			<div class="paging">
				<?php echo $this->Paginator->prev('<< ' . __d('store','previous', true), array(), null, array('class'=>'disabled'));?>
				<?php echo $this->Paginator->numbers(array('separator'=>false));?>
				<?php echo $this->Paginator->next(__d('store','next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
			</div>
			<div class="clr"></div>	
			
			<table class="index" cellpadding="0" cellspacing="0">
			<tr>
					<th width="100">&nbsp;</th>
					<th><?php echo $this->Paginator->sort(__d('store','Serial',true),'serial_number');?> | <?php echo $this->Paginator->sort(__d('store','Name',true),'name');?></th>
					<th><?php echo $this->Paginator->sort(__d('store','Offer Type',true),'model_id');?></th>
					<th <?php if(!$session->check('Auth.User.id')){?> class="actions" <?php }?>><?php echo $this->Paginator->sort(__d('store','Price',true),'price_detaliczna');?></th>
					<?php if($session->check('Auth.User.id')){?><th class="actions"><?php __d('store','Actions');?></th><?php }?>
			</tr>
			<?php
			$i = 0;
			foreach ($storeProducts as $storeProduct):
				$class = null;
				if ($i++ % 2 == 0) {
					$class = ' class="altrow"';
				}
			?>
			<tr<?php echo $class;?>>
				<td valign="middle">
					<?php echo $this->Html->link($fileUpload->image($storeProduct['StoreUpload']['name'],array('autoResize'=>true,'width'=>100,'imagePathOnly'=>false))
						, array('action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),array('escape'=>false)); ?>&nbsp;
				</td>
				<td valign="top">
					<?php echo __d('store','Serial Number: ',true).$storeProduct['StoreProduct']['serial_number']; ?>
					<br/>
					<?php echo $this->Html->link($storeProduct['StoreProduct']['name'], array('action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),array('escape'=>false)); ?>
					
					
					&nbsp;
				
				</td>
				<td valign="top">
					<?php echo $storeProduct['StoreModel']['name']; ?>
					&nbsp;
				</td>
				<td valign="middle"  align="right" <?php if(!$session->check('Auth.User.id')){?> class="actions" <?php }?>>
				    <?php if($storeProduct['StoreProduct']['price_przecena'] > 0 && $storeProduct['StoreProduct']['price_promocja'] == 0){?>
							<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],2,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'] );?></span> 
							<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_przecena'],2,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							 
					<?php }else if( $storeProduct['StoreProduct']['price_promocja'] > 0){?>
							<span class="product-view-price-discount"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],2,'','',$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange']);?></span> 
							<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_promocja'],2,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span> 							
					<?php }else{?>
							<span class="product-view-price"><?php echo $this->Store->price($storeProduct['StoreProduct']['price_detaliczna'],2,'',null,$storeProduct['StoreProduct']['currency_id'],$storeProduct['StoreCurrency']['exchange'])?></span>
					<?php }?>
					<br/>
					<?php echo $html->link($html->image(HOST.'/see_more.png'), 
				        array('plugin'=>'store','controller'=>'products','action' => 'view', $storeProduct['StoreProduct']['id'],Inflector::slug($storeProduct['StoreProduct']['name'],'-')),
				        array('escape'=>false)); ?>	
				</td>
				<?php if($session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'admin' || $session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'manag'){?>
				<td valign="top" class="actions">
					<?php echo $html->link($html->image('firma/actions_16_view.png',array('title'=>__d("store","View",true))), 
				        array('plugin'=>'store','controller'=>'products','action'=>'view',$storeProduct['StoreProduct']['id']),
				        array('escape'=>false,'class'=>'')); ?>
					<?php echo $html->link($html->image('firma/actions_16_edit.png',array('title'=>__d("store","Edit",true))), 
				        array('plugin'=>'store','controller'=>'products','action'=>'edit',$storeProduct['StoreProduct']['id']),
				        array('escape'=>false,'class'=>'')); ?>
					<?php echo $this->Html->link($html->image('firma/actions_16_delete.png',array('title'=>__d("store","Delete",true))), array('plugin'=>'store','controller'=>'products','action'=>'delete', $storeProduct['StoreProduct']['id']), array('escape'=>false), sprintf(__d('store','Are you sure you want to delete # %s?', true), $storeProduct['StoreProduct']['id'])); ?>
				    <?php //echo $html->link($html->image('firma/actions_16_up.png',array('title'=>__d('store','Up',true))), array('plugin'=>'store','controller'=>'products','action'=>'up',$storeProduct['StoreProduct']['id'],'lp_categ','category_id'), array('escape'=>false,'class'=>'')); ?> 
				    <?php // echo $html->link($html->image('firma/actions_16_down.png',array('title'=>__d('store','Down',true))), array('plugin'=>'store','controller'=>'products','action'=>'down',$storeProduct['StoreProduct']['id'],'lp_categ','category_id'),  array('escape'=>false,'class'=>'')); ?>						
				</td>
				<?php }?>
			</tr>
		<?php endforeach; ?>
			</table>
			<p>
			<?php
			echo $this->Paginator->counter(array(
			'format' => __d('store','Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
			));
			?>
			</p>		
			<div class="paging">
				<?php echo $this->Paginator->prev('<< ' . __d('store','previous', true), array(), null, array('class'=>'disabled'));?>
				<?php echo $this->Paginator->numbers(array('separator'=>false));?>
				<?php echo $this->Paginator->next(__d('store','next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
			</div>
		</div>		

	</div>	

	<div class="clr"></div>	
	
	<?php if($session->check('Auth.User.id')){?>
	<?php echo $this->element('toolbar_actions_main',array('plugin'=>'store','toolbar'=>'product'))?>
	<?php }?>
	
</div>
<div class="clr"></div>	